import { TreeSelect } from 'antd'
import useAsyncOptions from '../../hooks/useAsyncOptions'

const MyTreeSelect = ({ options, value, onChange, ...restItem }) => {
  const { asyncOptions } = useAsyncOptions(options)

  return (
    <TreeSelect
      treeData={asyncOptions}
      value={value}
      onChange={onChange}
      multiple
      allowClear
      showSearch
      treeCheckable
      maxTagCount="responsive"
      { ...restItem }
    />
  )
}

export default MyTreeSelect
